<template>
  <div class="WorkingSchedule" v-loading="loading">
    <el-form ref="form" :model="form" label-position="top" class="myform">
      <div>
        <el-form-item label="款号" class="myform-item">
          <el-input
            v-model="form.type_no"
            placeholder="请输入款号"
            @keyup.enter.native="onSearch"
            clearable
          ></el-input>
        </el-form-item>
      </div>
      <div>
        <el-form-item style="margin-top: 50px">
          <el-button type="primary" @click="onSearch">查询</el-button>
        </el-form-item>
      </div>
    </el-form>
    <el-table :data="tableData" style="width: 100%; margin-top: 20px" border>
      <el-table-column label="款号" align="center" prop="type_no">
      </el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="{ row }">
          <el-button type="text" @click="onLook(row.type_no)">查看</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      style="clear: both"
      :form="form"
      :total="total"
      @paginationPostOrderTaskList="postAdminOperateFanorder"
    />
  </div>
</template>

<script>
import { postAdminOperateFanorder } from "@/api";
import pagination from "@/components/pagination.vue";
export default {
  components: { pagination },
  data() {
    return {
      loading: false,
      date: "",
      form: {
        type_no: "",
        page: 1,
        size: 10,
      },
      tableData: [],
      total: 0,
    };
  },
  activated() {
    let form = this.form;
    this.postAdminOperateFanorder(form);
  },
  methods: {
    // 翻单详情
    onLook(typeno){
        this.$router.push({name:"ReorderRecordDetail",query: { typeno } })
    },
    onSearch() {
      this.form.page = 1;
      this.postAdminOperateFanorder(this.form);
    },
    // 采购列表
    async postAdminOperateFanorder(data) {
      this.loading = true;
      this.form = data;
      postAdminOperateFanorder(data)
        .then((res) => {
          this.loading = false;
          console.log("采购列表", res);
          this.tableData = res.data;
          this.total = Number(res.total);
        })
        .catch((err) => {
          this.loading = false;
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.exportdialogVisible {
  > div:nth-child(1) {
    display: flex;
    > div {
      > span {
        font-weight: 600;
      }
    }
  }
  > div:nth-child(2) {
    margin: 20px 0;
    display: flex;
    > span {
      > span {
        font-weight: 600;
      }
    }
  }
  > div:nth-child(3) {
    display: flex;
    align-items: center;
    /deep/ .el-input {
      width: 200px;
      color: #409eff;
    }
  }
}
.cancellationdialogVisible {
  > div:nth-child(1) {
    display: flex;
    > div {
      > span {
        font-weight: 600;
      }
    }
  }
  > div:nth-child(2) {
    margin-top: 20px;
    display: flex;
    align-items: center;
    /deep/ .el-input {
      width: 200px;
    }
    > div:nth-child(3) {
      margin: 0 10px;
      width: 30px;
      height: 1px;
      background: #666;
    }
  }
}
.myform {
  display: flex;
  justify-content: space-between;
  > div {
    display: flex;
  }
  &-item {
    margin-right: 10px;
  }
}
.export {
  margin-top: 20px;
  display: flex;
  align-items: center;
  float: right;
  > div {
    margin-right: 20px;
    > span {
      color: #409eff;
      font-size: 18px;
      padding: 0 5px;
    }
  }
}
.WorkingSchedule {
  background: #ffff;
  padding: 20px;
  border-radius: 2px;
  @include boxShadow;
}
</style>
